//引入封装的axios
import request from '../util/request'
//引入url封装的js
import {KEY,API_24H,API_7D, API_GEO,API_HOST, API_AIR, API_INDICES} from './urlAPI';

//未来24小时天气预报请求
export const fetch24HourData =(locationID)=>{
    return request.get(API_24H,{
        params:{
            location:locationID,
            key: KEY,
        }
    })
}

//未来7天天气预报请求
 export const fetch7DayData =(locationID)=>{
    return request.get(API_7D,{
        params:{
            location: locationID,
            key: KEY,
        }
    })
}
//export {fetch24HourData,fetch7DayData}

//城市搜索请求
export const fetchCityData =(cityName)=>{
    return request.get(API_GEO,{
        params:{
            location: cityName,
            key: KEY,
        }
    })
}

//实时天气请求
export const fetchNowData =(locationID)=>{
    return request.get(API_HOST,{
        params:{
            location: locationID,
            key: KEY,
        }
    })
}

//空气质量请求
export const fetchAirData =(locationID)=>{
    return request.get(API_AIR,{
        params:{
            location: locationID,
            key: KEY,
        }
    })
}

//空气质量请求
export const fetchIndicesData =(locationID,type)=>{
    return request.get(API_INDICES,{
        params:{
            location: locationID,
            type:type,
            key: KEY,
        }
    })
}